import { myPost } from '@/util/request'
import { API_SERVER } from '../service'

const ADMIN_SERVER = `${API_SERVER}/v2/admin`

// 数据源管理API
export const dataSource = {
  page: data => myPost(`${ADMIN_SERVER}/database/page`, data ),
  add: data => myPost(`${ADMIN_SERVER}/database/add`, data ),
  edit: data => myPost(`${ADMIN_SERVER}/database/edit`, data ),
  delete: data => myPost(`${ADMIN_SERVER}/database/delete`, data ),
  test: data => myPost(`${ADMIN_SERVER}/database/test`, data ),
  detail: data => myPost(`${ADMIN_SERVER}/database/detail`, data )
}

// 元数据管理API
export const metadata = {
  page: data => myPost(`${ADMIN_SERVER}/metadata/table/page`, data ),
  edit: data => myPost(`${ADMIN_SERVER}/metadata/table/edit`, data ),
  tableImp: data => myPost(`${ADMIN_SERVER}/metadata/table/imp`, data ),
  delete: data => myPost(`${ADMIN_SERVER}/metadata/table/delete`, data ),
  batdelete: data => myPost(`${ADMIN_SERVER}/metadata/table/batdelete`, data ),
  detail: data => myPost(`${ADMIN_SERVER}/metadata/table/detail`, data ),
  tableImpsave: data => myPost(`${ADMIN_SERVER}/metadata/table/impsave`, data ),

  tableProperties: data => myPost(`${ADMIN_SERVER}/metadata/table/properties`, data ),
  propertiesEdit: data => myPost(`${ADMIN_SERVER}/metadata/table/properties/edit`, data ),
  propertiesDetail: data => myPost(`${ADMIN_SERVER}/metadata/table/properties/detail`, data ),
  propertiesDelete: data => myPost(`${ADMIN_SERVER}/metadata/table/properties/delete`, data ),
  propertiesBatedit: data => myPost(`${ADMIN_SERVER}/metadata/table/properties/batedit`, data ),
  propertiesBatdelete: data => myPost(`${ADMIN_SERVER}/metadata/table/properties/batdelete`, data ),
  tableSync: data => myPost(`${ADMIN_SERVER}/metadata/table/sync`, data ),
  tableData: data => myPost(`${ADMIN_SERVER}/metadata/table/data`, data ),
}

const DICTIONARY_SERVER = `${API_SERVER}/v2/sysdic`
// 字典管理
export const dictionary = {
  page: data => myPost(`${DICTIONARY_SERVER}/page`, data ),
  add: data => myPost(`${DICTIONARY_SERVER}/add`, data ),
  edit: data => myPost(`${DICTIONARY_SERVER}/edit`, data ),
  delete: data => myPost(`${DICTIONARY_SERVER}/delete`, data ),
  detail: data => myPost(`${DICTIONARY_SERVER}/getSysdic`, data )
}

const MODELMANAGE_SERVER = `${API_SERVER}/v2/report/cube`
// 模型管理
export const modelManage = {
  page: data => myPost(`${MODELMANAGE_SERVER}/list`, data ),
  add: data => myPost(`${MODELMANAGE_SERVER}/add`, data ),
  edit: data => myPost(`${MODELMANAGE_SERVER}/edit`, data ),
  delete: data => myPost(`${MODELMANAGE_SERVER}/delete`, data ),
  detail: data => myPost(`${MODELMANAGE_SERVER}/detail`, data ),
  publish: data => myPost(`${MODELMANAGE_SERVER}/publish`, data ),

  typeList: data => myPost(`${MODELMANAGE_SERVER}/type/list`, data ),
  typeAdd: data => myPost(`${MODELMANAGE_SERVER}/type/add`, data ),
  typeEdit: data => myPost(`${MODELMANAGE_SERVER}/type/edit`, data ),
  typeDetail: data => myPost(`${MODELMANAGE_SERVER}/type/detail`, data ),
  typeDelete: data => myPost(`${MODELMANAGE_SERVER}/type/delete`, data ),
}